<template>
	<view class="content" v-if="show==1">
			<view class="tel">客户热线</view>
			<view class="tel2">{{tel}}</view>
			<view class="tel3" @click="dian">联系客服</view>
		  <view class="goods">
			<view class="ping">
				<view class="ping2">
					<textarea @input="content2" placeholder="您有什么建议,快来告诉我们吧"></textarea>
				</view>
			</view>
		  </view>
		  <view class="bottom" @click="tijiao">
			  <view class="bottom2">提交</view>
		  </view>
	</view>
</template>

<script>
	var app=getApp();
	export default {
		data() {
			return {
				uid:0,
				show:0,
				content:'',
				tel:''
			}
		},
		onLoad() {
			const uid = uni.getStorageSync('uid');
			if(app.isBlank(uid)==true){
				app.error_msg("请先登录");
			}
			this.uid=uid;
			this.getdata();
		},
		methods: {
			getdata(){
				var that=this;
				uni.showLoading({
				    title: '数据加载中'
				});
				uni.request({
				    url: app.globalData.url+"user/tel",
					method:"POST",
					dataType:"json",
					header: {
					    'content-type': 'application/x-www-form-urlencoded'
					},
				    data: {uid:that.uid},
				    success: (res) => {
						uni.hideLoading();
						if(res.data.code!=1){
							app.error_msg(res.data.msg);
						}
						that.tel=res.data.data.tel
						that.show=1;
				    }
				});
			},
			dian(){
				uni.makePhoneCall({
				    phoneNumber: this.tel
				});
			},
			tijiao(){
				var that=this;
				if(app.isBlank(this.content)==true){
					uni.showToast({
					    title: "请填意见内容",
						icon:'none',
					    duration: 1000
					});
					return false;
				}
				uni.showLoading({
				    title: '提交中'
				});
				
				uni.request({
				    url: app.globalData.url+"user/yijian",
					method:"POST",
					dataType:"json",
					header: {
					    'content-type': 'application/x-www-form-urlencoded'
					},
				    data: {uid:that.uid,content:that.content},
				    success: (res) => {
						uni.hideLoading();
						if(res.data.code!=1){
							uni.showToast({
							    title: res.data.msg,
								icon:'none',
							    duration: 1000
							});
							return false;
						}
						uni.showToast({
						    title: res.data.msg,
						    duration: 1000
						});
						setTimeout(function(){
							uni.switchTab({
							    url: '/pages/user/index'
							});
						},1000)
				    }
				});
			},
			content2: function(event) {
				this.content=event.target.value;
			}
		}
	}
</script>

<style>
	.tel{width:100%;text-align: center;margin-top: 40px;}
	.tel2{width:100%;text-align: center;margin-top: 20px;font-size: 1.4rem;}
	.tel3{width:80px;height:30px;line-height: 30px;text-align: center;border: 1px #05c160 solid;color: #05c160;margin: 20px auto;border-radius: 5px;}
	.bottom2{width:94%;margin: 0 3%;height:40px;line-height: 40px;text-align: center;background-color: #05c160;color:#fff;margin-top: 5px;border-radius: 5px;z-index:9999;}
	.bottom{width:100%;height:51px;margin-top: 20px;}
	.ping .cha{width:20px;border-radius: 50%;background-color: #fff;position: absolute;top:0px;right:0px;z-index:9999;}
	.ping5 .tu{width:100%;}
	.ping5{width:70px;height:70px;margin-top: 10px;overflow: hidden;float: left;margin-right: 10px;position:relative;}
	.ping4{overflow: hidden;}
	.ping3{width:100%;}
	.ping textarea{width:94%;padding: 6px 3%;height:100px;line-height: 20px;font-size: 0.85rem;background-color: #f5f5f5;border-radius: 5px;}
	.ping2{width:100%;}
	.ping{width: 94%;padding: 0px 3%;}
	.goods{width:100%;padding-bottom: 10px;margin-top: 20px;}

	.count{width:94%;padding:0px 3%;height:40px;line-height: 40px;color:#666;border-bottom: 1px rgb(245, 245, 245) solid;}
	.goods_1{width:94%;padding: 0px 3%;overflow: hidden;margin-top: 10px;display: flex;margin-bottom: 20px;}
	.img{width:100px;height: 67px;margin-right: 8px;}
	.img image{width:100px;border-radius: 5px;height:67px;}
	.title{width:100%;flex: 1;}
	.biao{width:100%;height:47px;line-height: 23.5px;color:#666;overflow: hidden;}
	.guige{width:100%;height:20px;line-height: 20px;color:red;overflow: hidden;}
	.price{width:100%;height:25px;line-height: 25px;color:#f36;}
	.amount{width:15%;float: left;text-align: center;color:#999;line-height: 25px;}
	.amount text{font-size: 0.6rem;margin-right: 3px;}
	
</style>
